package rn;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import sun.misc.BASE64Encoder;

/**
 *
 * @author roberta.m.carvalho
 */
public class CriptografarSenha {  
      
    /** Creates a new instance of EncriptaSenha */  
    public CriptografarSenha() {          
    }  
      
     public static String encripta (String senha) {  
         try    {  
             MessageDigest digest = MessageDigest.getInstance("MD5");  
             digest.update(senha.getBytes());  
             BASE64Encoder encoder = new BASE64Encoder ();   
             return encoder.encode(digest.digest());   
         }catch (NoSuchAlgorithmException ns) {  
             return senha;  
         }  
     }      
      
}
